package com.monitor.vo.enumeration;

import java.util.HashMap;

/**
 * @ClassName MonitorRetStatus
 * @Package com.monitor.vo.enumeration
 * @Description 请求状态 010-初始化状态 020-成功 030-失败 040-无效 050-其他
 * @Author zhixingbai
 * @Create 2018/10/1114:15
 */
public enum MonitorRetStatus {

    INIT("010", "初始化状态"),

    SUCCESS("020", "成功"),

    FAILE("030", "失败"),

    INVALID("040", "无效"),

    OTHER("050", "其他");


    private static HashMap<String, MonitorRetStatus> map = new HashMap<>();

    static {
        for (MonitorRetStatus inst : MonitorRetStatus.values()) {
            map.put(inst.code, inst);
        }
    }

    private String code;

    private String msg;

    MonitorRetStatus(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
    public static MonitorRetStatus valueOfCode(Integer code) {
        MonitorRetStatus result = map.get(code);
        if (result == null) {
            throw new IllegalArgumentException("未知的枚举类型：" + code + ",请核对枚举");
        }
        return result;
    }
}
